package com.liuzu.esys.controller;

import com.liuzu.esys.common.LayuiPageVo;
import com.liuzu.esys.common.R;
import com.liuzu.esys.mapper.DivisionStaffMapper;
import com.liuzu.esys.pojo.DivisionStaff;
import com.liuzu.esys.service.DivisionStaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author : 逸少
 * @time : 2022/7/27
 * @desc :
 */
@RestController
@RequestMapping("/divisionStaff")
public class DivisionStaffController {

    @Autowired
    private DivisionStaffService divisionStaffService;

    //分页显示信息和模糊查询
    @RequestMapping("/divisionstaffList")
    public LayuiPageVo<DivisionStaff>divisionStaffLayPageVo(@RequestParam Map<String,Object> params) {
        return divisionStaffService.divisionStaffPageData(params);
    }
    //添加
    @RequestMapping("/addDivisionStaff")
    public R addDivisionStaffList(DivisionStaff divisionStaff) {
        int result = divisionStaffService.addDivisionStaff(divisionStaff);
        if (result == 1) {
            return R.ok();
        }
        return R.error();
    }
    //修改
    @RequestMapping("/divisionStaffUpdate")
    public R divisionStaffListUpdate(DivisionStaff divisionStaff) {
        int i = divisionStaffService.divisionStaffUpdate(divisionStaff);
        if (i == 1) {
            return R.ok();

        }
        return R.error();
    }
    //删除
    @RequestMapping("/divisionStaffDelete")
    public R divisionStaffListDelete(int id) {
        int i = divisionStaffService.divisionStaffDelete(id);
        if (i == 1) {
            return R.ok();
        }
        return R.error();
    }

}
